package cn.lotusnut.esdemo.entity;

import cn.lotusnut.esdemo.constant.ElasticSearchConstant;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.math.BigDecimal;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Document(indexName = "woniumall")
public class Goods {
    //FieldType.Keyword 可理解为主键，不会进行分词
    @Field(type = FieldType.Keyword)
    private Integer id;
    @Field(type = FieldType.Text, analyzer = ElasticSearchConstant.IK_MAX_WORD, searchAnalyzer = ElasticSearchConstant.IK_SMART)
    private String name;
    @Field(type = FieldType.Text)
    private String goodssno;
    @Field(type = FieldType.Text, analyzer = ElasticSearchConstant.IK_MAX_WORD, searchAnalyzer = ElasticSearchConstant.IK_SMART)
    private String publisher;
    @Field(type = FieldType.Text)
    private String pubtime;
    @Field(type = FieldType.Text, analyzer = ElasticSearchConstant.IK_MAX_WORD, searchAnalyzer = ElasticSearchConstant.IK_SMART)
    private String description;
    @Field
    private BigDecimal salesprice;
    @Field
    private Integer salenums;
}
